<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>title</title>
    <link rel="stylesheet" type="text/css" href="../css/api.css"/>
    <script src="../script/api.js"></script>
    <script type="text/javascript" src="../script/constants.js"></script>
    <script type="text/javascript" src="../script/aes.js"></script>
    <script type="text/javascript" charset="UTF-8" src="../script/naes.js"></script>
    <script type="text/javascript" src="../script/modeecb.js"></script>
    <script src="../script/tmd5.js"></script>
    <script src="resource/jquery214.js"></script>
    <style>
    	body{
    		
    	}
    </style>
</head>
<body>
	<div>
        <img id="banner1" src="../image/top.png" style="width: 100%;position:relative;">
</div>
   <div style="display: table;margin-top: 5px;padding-bottom: 20px;padding-top: 20px;" id="perService">
	   <div style="float:left;width:25%;text-align: center;" onclick="xshfk()">
		 <div><img style="width:40%" src="../image/tabBar/qrcode.png"></div>
		 <div style="font-size: 12px;margin-top:10px;">付款二维码</div>
		 </div>
		 <div style="float:left;width:25%;text-align: center;" onclick="ylcard()">
		  <div><img style="width:40%" src="../image/tabBar/bankcard.png"></div>
		 <div style="font-size: 12px;margin-top:10px;">银行卡</div>
		 </div>
		 <div id="gongan" style="float:left;width:25%;text-align: center;" onclick="jyjl()">
		  <div><img style="width:40%" src="../image/tabBar/history.png"></div>
		 <div style="font-size: 12px;margin-top:10px;">历史记录</div>
		 </div>
	</div>
</body>
<script type="text/javascript" src="../script/api.js"></script>
<script type="text/javascript">
	apiready = function(){
		
	};
	
  function scannerYl(){
    var FNScanner = api.require('FNScanner');
    FNScanner.openScanner({
      autorotation: true
    }, function(ret, err) {
      if (ret.eventType=="success") {
        api.openWin({
          name: 'ylpay',
          url: 'ylpay.jsp',
          pageParam: {
            name: 'test'
          }
        });

      }
    });
  }


  function ylcard() {
    var dlPhone = $api.getStorage("dl_phone");
    var aeskey = api.loadSecureValue({
      sync: true,
      key: 'aeskey'
    });
    var salt = api.loadSecureValue({
      sync: true,
      key: 'salt'
    });
    var s = api.connectionType;

    if(s=='none'){
      alert("无网络，请稍后再试");
    }else{
      var content = {"dlPhone":dlPhone,"phone":dlPhone};
      var sign = md5(JSON.stringify(content)+salt);
      var p = {"sign":sign,"content":JSON.stringify(content)};
      var para = Encrypt(JSON.stringify(p),aeskey);
      para = para.replace(/\+/g,"%2B");
      api.openWin({
          name: 'xshfk',
          progress: {
            type: "default",                //加载进度效果类型，默认值为 default，取值范围为 default|page，default 等同于 showProgress 参数效果；为 page 时，进度效果为仿浏览器类型，固定在页面的顶部
            title: "",               //type 为 default 时显示的加载框标题
            text: "加载中...",                //type 为 default 时显示的加载框内容
            color: "#fff"                //type 为 page 时进度条的颜色，默认值为 #45C01A，支持#FFF，#FFFFFF，rgb(255,255,255)，rgba(255,255,255,1.0)等格式
          },
          url: url.getbankcard+"?para="+para
       });
    }




  }


  function jyjl() {
    var dlPhone = $api.getStorage("dl_phone");
    var s = api.connectionType;
    var aeskey = api.loadSecureValue({
      sync: true,
      key: 'aeskey'
    });
    var salt = api.loadSecureValue({
      sync: true,
      key: 'salt'
    });
    if(s=='none'){
      alert("无网络，请稍后再试");
    }else{
      var content = {"phone":dlPhone};
      var sign = md5(JSON.stringify(content)+salt);
      var p = {"sign":sign,"content":JSON.stringify(content)};
      var para = Encrypt(JSON.stringify(p),aeskey);
      para = para.replace(/\+/g,"%2B");
      api.openWin({
          name: 'xshfk',
          progress: {
            type: "default",                //加载进度效果类型，默认值为 default，取值范围为 default|page，default 等同于 showProgress 参数效果；为 page 时，进度效果为仿浏览器类型，固定在页面的顶部
            title: "",               //type 为 default 时显示的加载框标题
            text: "加载中...",                //type 为 default 时显示的加载框内容
            color: "#fff"                //type 为 page 时进度条的颜色，默认值为 #45C01A，支持#FFF，#FFFFFF，rgb(255,255,255)，rgba(255,255,255,1.0)等格式
          },
          url: url.getTransaction+"?para="+para
       });
    }

  }


  function xshfk(){
    var dlPhone = $api.getStorage("dl_phone");
    $("#loadingToast").show();
    var s = api.connectionType;

    if(s=='none'){
      $("#loadingToast").hide();
      alert("无网络，请稍后再试");
    }else{

      var aeskey = api.loadSecureValue({
        sync: true,
        key: 'aeskey'
      });
    var ip = "0.0.0.0";
    var ipAddr = api.require('ipAddress');
    $api.setStorage("ip",ip);
      $("#loadingToast").hide();
      var salt = api.loadSecureValue({
        sync: true,
        key: 'salt'
      });
      var aeskey = api.loadSecureValue({
        sync: true,
        key: 'aeskey'
      });
      var demo = api.require('ipAddress');
      demo.getIp({
        isNetIp: true
      },function(ret, err) {
        if (ret.status) {
          ip = ret.ip;
        }
        var content = {"dlPhone": dlPhone, "ip": ip, "deviceID": api.deviceId, "phone": dlPhone};
        var sign = md5(JSON.stringify(content) + salt);
        var p = {"sign": sign, "content": JSON.stringify(content)};
        var para = Encrypt(JSON.stringify(p), aeskey);
        para = para.replace(/\+/g, "%2B");
        api.openWin({
          name: 'xshfk',
          progress: {
            type: "default",                //加载进度效果类型，默认值为 default，取值范围为 default|page，default 等同于 showProgress 参数效果；为 page 时，进度效果为仿浏览器类型，固定在页面的顶部
            title: "",               //type 为 default 时显示的加载框标题
            text: "加载中...",                //type 为 default 时显示的加载框内容
            color: "#fff"                //type 为 page 时进度条的颜色，默认值为 #45C01A，支持#FFF，#FFFFFF，rgb(255,255,255)，rgba(255,255,255,1.0)等格式
          },
          url: url.getQr+'?para=' + para
        });
      });
    }
  }

</script>
</html>